<ul class="matchgroups">
<?php foreach($matchgroups as $mg): ?>
		<li><a href="<?=site_url('admin/matchgroup/'.$mg->matchgroup)?>"><span><?=$mg->matchgroup;?></span></a></li>
<?php endforeach; ?>
</ul>

<?php $i=0; foreach($matches as $match): ?>

	<?php if ($i == 0 || $match->matchgroup != $matches[$i-1]->matchgroup): ?>
		<div id="matchtab<?=$match->matchgroup?>">
			<?=form_open('admin/calculatePoints', array('id' => 'matchForm'));?>
			<h3><? printf(lang('matchgroup_type'), $match->matchgroup);?></h3>
			<table width="100%" border="0" cellpadding="2" cellspacing="2"><tbody>		
	<?php endif; ?>

	
	<tr<?php if ($i % 2 == 0) echo ' class="odd"'; else echo ' class="even"'; ?>>
		<td>
			<span class="match"><?=$match->team_h?> - <?=$match->team_a?></span>
			<input class="hidden" name="id[]" type="hidden" value="<?=$match->id?>" />
		</td><td>
			<input class="goals" name="goals_h[]" type="text" value="<?=$match->goals_h?>" maxlength="2" />
			<input class="goals" name="goals_a[]" type="text" value="<?=$match->goals_a?>" maxlength="2" />
		</td>
		<td id="date<?=$match->id?>" class="date editable"><?=$match->deadline?></td>
		<td class="btn"><? $btn = dateButtons($match->id, $match->deadline); echo $btn; ?></td>
	</tr>

	<?php if ($i == (sizeof($matches)-1) || $match->matchgroup != $matches[$i+1]->matchgroup): ?>
			</tbody></table><br/>
			<input class="submit" type="submit" />
			<input type="hidden" name="group" value="<?=$match->matchgroup?>"/>
			<?=form_close();?>
		</div>
	<?php endif; ?>

	<?php $i++;?>
<?php endforeach; ?>

